import 'package:flutter/material.dart';

class StateFulCase extends StatefulWidget {
  const StateFulCase({Key? key, required this.title}) : super(key: key);
  final String title;
  @override
  _StateFulCaseState createState() => _StateFulCaseState();
}

class _StateFulCaseState extends State<StateFulCase> {
  int count = 0;
  @override
  Widget build(BuildContext context) {  
    return Container(
      child: Column(children: [
        Text(widget.title, style: TextStyle(fontSize: 40)),
        Row(children: [
          ElevatedButton(
              onPressed: () {
                setState(() {
                  count--;
                });
              },
              child: Text("-")),
          Text(
            this.count.toString(),
            style: TextStyle(fontSize: 40),
          ),
          ElevatedButton(
              onPressed: () {
                setState(() {
                  count++;
                });
              },
              child: Text("+"))
        ])
      ]),
    );
  }
}
